import { registerDecorator, ValidationOptions, ValidationArguments } from 'class-validator'

export function IsEnterPassword(validationOptions?: ValidationOptions) {
   return function (object: Object, propertyName: string) {
      registerDecorator({
         name: 'IsEnterPassword',
         target: object.constructor,
         propertyName: propertyName,
         options: validationOptions,
         validator: {
            validate(value: any, args: ValidationArguments) {
               return value == (args.object as any).password
            }
         }
      })
   }
}
